<!DOCTYPE HTML>
<html lang="en">
<head>
<title>FileRemoveDir - Syntax &amp; Usage | AutoHotkey</title>
<meta name="description" content="The FileRemoveDir command deletes a folder." />
<meta name="ahk:equiv-v2" content="commands/DirDelete.htm" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>FileRemoveDir</h1>

<p>Deletes a folder.</p>

<pre class="Syntax"><span class="func">FileRemoveDir</span>, DirName <span class="optional">, Recurse</span></pre>
<h2>Parameters</h2>
<dl>

  <dt>DirName</dt>
  <dd><p>Name of the directory to delete, which is assumed to be in <a href="../Variables.htm#WorkingDir">%A_WorkingDir%</a> if an absolute path isn't specified.</p></dd>

  <dt>Recurse</dt>
  <dd>
    <p>This parameter determines whether to recurse into subdirectories. If omitted, it defaults to 0 (false). Specify one of the following values:</p>
    <p><strong>0</strong> (false): Do <strong>not</strong> remove files and sub-directories contained in <em>DirName</em>. In this case, if <em>DirName</em> is not empty, no action will be taken and ErrorLevel will be set to 1.</p>
    <p><strong>1</strong> (true): Remove all files and subdirectories (like the Windows command &quot;rmdir /S&quot;).</p>
    <p>This parameter can be an <a href="../Variables.htm#Expressions">expression</a>, even one that evalutes to true or false (since true and false are stored internally as 1 and 0).</p>
  </dd>

</dl>
<h2>Error Handling</h2>
<p><span class="ver">[v1.1.04+]</span>: This command is able to throw an exception on failure. For more information, see <a href="Catch.htm#RuntimeErrors">Runtime Errors</a>.</p>
<p><a href="../misc/ErrorLevel.htm">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<h2>Remarks</h2>
<p>None</p>
<h2>Related</h2>
<p><a href="FileCreateDir.htm">FileCreateDir</a>, <a href="FileDelete.htm">FileDelete</a></p>
<h2>Examples</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>FileRemoveDir, C:\Download Temp
FileRemoveDir, C:\Download Temp, 1</pre>
</div>

</body>
</html>
